package com.work.straighttalk.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import butterknife.ButterKnife;

/**
 * 泛型T 为由继承类决定的 holder持有的可加载数据类型
 *
 * @param <T>
 */
public abstract class BaseViewHolder<T> extends RecyclerView.ViewHolder {


    public BaseViewHolder(Context context, ViewGroup root, int layoutRes) {
        super(LayoutInflater.from(root.getContext()).inflate(layoutRes, root, false));
        ButterKnife.bind(this, itemView);
    }

    public Context getContext() {
        return itemView.getContext();
    }

    /**
     * 数据加载抽象方法
     *
     * @param t
     */
    public abstract void bindData(T t);
}